package in.animeshpathak.saferstreets.models;

import java.util.Date;
import java.util.List;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.beoui.geocell.annotations.Geocells;
import com.beoui.geocell.annotations.Latitude;
import com.beoui.geocell.annotations.Longitude;

import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.users.User;

/**
 * The incident report. Persistable
 * @author animesh
 *
 */
@PersistenceCapable
public class IncidentReport {
	
	/** The key to the incident report */
	@PrimaryKey
    @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
    private Key key;
	
	/** flag to show or hide the user's ID when showing this incident report */
	@Persistent
	private boolean showId;
	
	
	/** The time when this incident happenned */
	@Persistent
	private Date timeStamp;
	
	
	/** The latitude of the incident report*/
	@Persistent
	@Longitude
	private double longitude;
	
	/** The longitude of the incident report*/
	@Persistent
	@Latitude
	private double latitude;
	
	@Persistent
	@Geocells
	private List<String> geocells;
	
	/** The altitute of the incident report*/
	@Persistent
	private double altitude;
	
	/** The accuracy of the incident report*/
	@Persistent
	private double accuracy;

	/** The type of the incident report*/
	@Persistent
	private String incidentType;
	
	/** The user who made the upload */
	@Persistent	
	private User reporter;
	
	/** The description. Free form*/
	@Persistent
	private String description;
	

	/**
	 * @param longitude
	 * @param latitude
	 * @param geocells
	 * @param altitude
	 * @param accuracy
	 * @param incidentType
	 * @param timestamp
	 * @param showId
	 */
	public IncidentReport(double longitude, double latitude, List<String> geocells, double altitude,
			double accuracy, String incidentType, Date timestamp, User reporter, boolean showId) {
		super();
		//TODO do basic error checking
		this.longitude = longitude;
		this.latitude = latitude;
		this.geocells = geocells;
		this.altitude = altitude;
		this.accuracy = accuracy;
		this.incidentType = incidentType;
		this.timeStamp = timestamp;
		this.reporter = reporter;
		this.showId = showId;
	}

	public double getLongitude() {
		return longitude;
	}

	public void setLongitude(double longitude) {
		this.longitude = longitude;
	}

	public double getLatitude() {
		return latitude;
	}

	public void setLatitude(double latitude) {
		this.latitude = latitude;
	}

	public double getAltitude() {
		return altitude;
	}

	public void setAltitude(double altitude) {
		this.altitude = altitude;
	}

	public double getAccuracy() {
		return accuracy;
	}

	public void setAccuracy(double accuracy) {
		this.accuracy = accuracy;
	}

	public String getIncidentType() {
		return incidentType;
	}

	public void setIncidentType(String incidentType) {
		this.incidentType = incidentType;
	}

	public Key getKey() {
		return key;
	}

	/**
	 * @return the showId
	 */
	public boolean getShowId() {
		return showId;
	}

	/**
	 * @param showId the showId to set
	 */
	public void setShowId(boolean showId) {
		this.showId = showId;
	}

	public List<String> getGeocells() {
		return geocells;
	}

	public void setGeocells(List<String> geocells) {
		this.geocells = geocells;
	}

	/**
	 * @return the timeStamp
	 */
	public Date getTimeStamp() {
		return timeStamp;
	}

	/**
	 * @param timeStamp the timeStamp to set
	 */
	public void setTimeStamp(Date timeStamp) {
		this.timeStamp = timeStamp;
	}

	/**
	 * @return the reporter
	 */
	public User getReporter() {
		return reporter;
	}

	/**
	 * @param reporter the reporter to set
	 */
	public void setReporter(User reporter) {
		this.reporter = reporter;
	}

	/**
	 * @return the description
	 */
	public String getDescription() {
		return description;
	}

	/**
	 * @param description the description to set
	 */
	public void setDescription(String description) {
		this.description = description;
	}
	

}
